﻿package tv.colmeia.game.assets {
	/**
	* ...
	* @author Martin Fabichak @ colmeia.tv
	*/
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import org.cove.ape.CircleParticle;
	import org.cove.ape.IForce;
	import org.cove.ape.RectangleParticle;
	import org.cove.ape.Vector;
	import org.cove.ape.VectorForce;
	import tv.colmeia.game.assets.sprites.VitimaSprite;
	
	import flash.events.Event;
	
	public class Vitima extends RectangleParticle {
		private var _rot:Number;
		
		public function Vitima(sprite:VitimaSprite) {
			super(sprite.x+sprite.width/2, sprite.y+sprite.height/2, sprite.width, sprite.height);
			this.collidable = true;
			this.setDisplay(sprite);
			
			this.px = 50;
			this.py = Math.ceil(Math.random() * 350) + 50;
			
			this.fall(50 + Math.ceil(Math.random() * 100), Math.ceil(Math.random() * 75 + 25));
			_rot = Math.random() * 10 + 5;
			sprite.addEventListener(Event.ENTER_FRAME, loop);
		}
		/**
		 * 
		 * @param	fx -> força no eixo X
		 * @param	fy -> força no eixo Y
		 */
		public function fall(fx:Number,fy:Number):void {
			this.addForce(new VectorForce(false, fx,fy));
			
		}
		private function loop(e:Event):void {
			this.angle += _rot;
		}
	}
	
}